{#
	Jinja / Django Template for GoodRelations Rich E-Commerce
	Written by Martin Hepp, http://www.heppnetz.de/.
	All templates and code are available under LPGL. Attribution kindly requested.
		
	This template is designed for a page listing all store locations for a shop or business.
	
	Wiki: http://www.ebusiness-unibw.org/wiki/GoodRelationsTemplates
	GoodRelations: http://purl.org/goodrelations/

	Input parameters:
	snippet : True or False
		False: return complete HTML page with proper RDFa header etc.
		True: return only an RDFa snippet to be inserted in another HTML page
	
	title : String for the HTML title element (only if snippet = False)
	rdf_uri (optional) : URI of an RDF/XML data dump file for the page, if available 
	company_name : Official name of the company operating the Web site (only if snippet = False)
	company_uri (optional) : Semantic URI of the company operating the store
	
	stores : A list of dictionaries describing the store locations. Each dictionary has the following properties:
		id : short identifier for the store, only [a-z0-9-_]. Used to define the hash fragment.
		name : Short label for the store
		description : Longer text describing the store
		language : ISO 639-1 code  (en, de, it, fr,...) for the language of all textual elements
		country : Country for the store
		city : City for the store
		zip : Postal code
		street : Street and street number
		phone : Phone number in including the international prefix ("+49-89-6004-4217")
		logo_uri (optional) : URI of a logo or image for the store
		gln (optional) : Global Location Number (GLN) for the store
		
		lat (optional) : Geo position of the store: Latitude
		long (optional) : Geo position of the store: Longitude
		
		opening_hours : A list of dictionaries holding the opening hours. Each dictionary has the following properties:
			opens : The opening time on a given day of week. Must be xsd:time format including seconds, e.g. "08:00:00"
			closes : The opening time on a given day of week.  Must be xsd:time format including seconds, e.g. "18:00:00"
			days : A list holding any of "Monday", "Tuesday", "Wednesday", "Thursday", 
			       "Friday", "Saturday", "Sunday", or "PublicHolidays"
			valid_from (optional) : This property specifies the beginning of the validity of the opening hour data.
			 		The format must be xsd:dateTime. A time-zone should be specified. For a time in GMT/UTC, simply add a "Z".
					Example: 2010-05-30T09:30:10Z.
			valid_through (optional) : Ending validity of opening hour data.
			
			valid_from and valid_through can be used to express special opening hours for holiday seasons etc.

#}
{% if snippet==False %}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" version="XHTML+RDFa 1.0" xml:lang="en">
<head>
	<title>{{title}}</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
{% if rdf_uri %}
	<link rel="meta" type="application/rdf+xml" title="GoodRelations rich e-commerce data in RDF/XML for {{company_name}}" 
		href="{{rdf_uri}}" />
{% endif %}
</head>
<body>
<!--- Visible page content -->
<p>
Demo page for store data in GoodRelations.<br />
Insert the regular HTML markup for your page here.
<br />
Written by Martin Hepp, http://www.heppnetz.de/.<br />
All templates and code are available under LPGL. Attribution kindly requested.
</p>
{% endif %}
<!--
	Jinja / Django Template for GoodRelations Rich E-Commerce
	Written by Martin Hepp, http://www.heppnetz.de/.
	All templates and code are available under LPGL. Attribution kindly requested.
	Wiki: http://www.ebusiness-unibw.org/wiki/GoodRelationsTemplates
	GoodRelations: http://purl.org/goodrelations/
-->
<!-- in RDFa 1.1, you can replace the next long div element by the abbreviation: <div profile="http://www.heppnetz.de/grprofile/"> -->
<div xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" 
	xmlns="http://www.w3.org/1999/xhtml" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:gr="http://purl.org/goodrelations/v1#" 
	xmlns:vcard="http://www.w3.org/2006/vcard/ns#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
	xmlns:media="http://search.yahoo.com/searchmonkey/media/" 
	xmlns:commerce="http://search.yahoo.com/searchmonkey/commerce/"> 
{% for store in stores %}
<div about="#{{store.id}}" typeof="vcard:VCard commerce:Business gr:LocationOfSalesOrServiceProvisioning">
	<div property="rdfs:label" content="{{store.name}}" xml:lang="{{store.language}}"></div>
	<div property="vcard:fn" content="{{store.name}}" xml:lang="{{store.language}}"></div>
	<div property="rdfs:comment" content="{{store.description}}" xml:lang="{{store.language}}"></div>
{% if company_uri %}
<!-- Semantic link from the company, note that we use rev, not rel! -->
	<div rev="gr:hasPOS" resource="{{company_uri}}"></div>
{% endif %}
	<div rel="vcard:adr">
		<div typeof="vcard:Address">
			<div property="vcard:country-name" content="{{store.country}}" xml:lang="{{store.language}}"></div>
			<div property="vcard:locality" content="{{store.city}}" xml:lang="{{store.language}}"></div>
			<div property="vcard:postal-code" content="{{store.zip}}"></div>
			<div property="vcard:street-address" content="{{store.street}}"></div>
		</div>
	</div>
	<div property="vcard:tel" content="{{store.phone}}"></div>
{% if store.lat and store.long %}
<!-- Geo position -->
	<div rel="vcard:geo">
		<div>
			<div property="vcard:latitude" content="{{store.lat}}" datatype="xsd:float"></div>
			<div property="vcard:longitude" content="{{store.long}}" datatype="xsd:float"></div>
		</div>
	</div>
{% endif %}
{% if store.logo_uri %}
<!-- Shop logo or image -->
	<div rel="foaf:depiction" resource="{{store.logo_uri}}"></div>
<!-- Company logo, Yahoo-specific: Image resources must be img elements, set to 1 x 1 pixels in here -->
	<span rel="media:image">
		<img src="{{store.logo_uri}}" height="1" width="1" alt="store logo"/>
	</span>
{% endif %}
<!-- the following line is very important, for it links between the data and the page that contains the data -->
	<div rel="foaf:page rdfs:seeAlso vcard:url" resource=""></div>
{% if store.gln %}
	<div property="gr:hasGlobalLocationNumber" content="{{store.gln}}" datatype="xsd:string"></div>
{% endif %}
{% for hours in store.opening_hours %}
	<div rel="gr:hasOpeningHoursSpecification">
		<div typeof="gr:OpeningHoursSpecification">
			<div property="gr:opens" content="{{hours.opens}}" datatype="xsd:time"></div>
			<div property="gr:closes" content="{{hours.closes}}" datatype="xsd:time"></div>
{% for day in hours.days %}
			<div rel="gr:hasOpeningHoursDayOfWeek" resource="http://purl.org/goodrelations/v1#{{day}}"></div>
{% endfor %}
{% if hours.valid_from and hours.valid_through %}
<!-- Validity of the opening hours -->
			<div property="gr:validFrom" datatype="xsd:dateTime" content="{{hours.valid_from}}"></div>
			<div property="gr:validThrough" datatype="xsd:dateTime" content="{{hours.valid_through}}"></div>
{% endif %}
		</div>
	</div>
{% endfor %}
</div>
{% endfor %}
</div>
{% if snippet==False %}
</body>
</html>
{% endif %}